{extend name='public/base'} {block name='content'}

<!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        {$item['item1']}
        <small>{$item['item2']}</small>
    </h1>
    <ol class="breadcrumb">
        <li>
            <a href="#">
                <i class="fa fa-dashboard"></i> {$item['item1']}</a>
        </li>
        <li class="active">{$item['item2']}</li>
    </ol>
</section>

<!-- Main content -->
<section class="content">
    <div class="panel panel-default">
        <ul class="layui-nav layui-bg-green">
                <li class="layui-nav-item "><a href="{:url('merchant/register/index')}">新增登记</a></li>
                <li class="layui-nav-item layui-this"><a href="{:url('merchant/register/record')}">登记记录</a></li>
        </ul>
    </div>

    <form class="form-horizontal layui-form" action="{:url('merchant/register/record')}" method="get">
        <div class="layui-form-item" style="margin-bottom: 0px;">
            <div class="layui-inline" style="float: right;">
                <div class="layui-input-inline" style="margin-right:0px;">
                    <input type="text"  name="allwhere" id="allwhere" autocomplete="off" class="layui-input" placeholder="输入姓名/卡号/绑定手机" >
                </div>
                <button type="submit" class="layui-btn layui-btn-sm layui-btn-warm" style="background: #009688;height:37px;">搜索</button>
            </div>
        </div>
    </form>

    <!-- Main content -->
    <section class="content">
            <!-- Info boxes -->
            <div class="row">
              <!-- <div class="clearfix visible-sm-block"></div> -->
      
              {volist name='list' id='vo'}

                <div class="col-md-3 col-sm-6 col-xs-12">
                    <div class="info-box">
                        <span class="info-box-icon bg-green"><img src="/static/img/user.png" alt="" class='fa' style="width:50px"></span>
            
                        <div class="info-box-content">
                            <span class="info-box-number">{$vo.name}</span>
                            <span class="info-box-text">
                                {switch name="$vo.sex"}
                                    {case value="1"}男{/case}
                                    {case value="2"}女{/case}
                                    {default /}不详
                                {/switch}
                                {empty name="$vo.birth"}
                                    未知
                                {else /}
                                    {$vo.birth}
                                {/empty}
                            </span>
                            <span class="info-box-text">
                                卡号:{empty name="$vo.card_id"}
                                    {$vo.phone_id}
                                {else /}
                                    {$vo.card_id}
                                {/empty}
                            </span>
                            <span class="info-box-text">注册时间:{$vo.addtime}</span>
                        </div>
                    <!-- /.info-box-content -->
                    </div>
                    <div class="info-box-btn" onclick="lotus_show('编辑病人信息','edit_record.html?id={$vo.id}',1200,800)">修改</div>
                    <!-- /.info-box -->
                </div>

              {/volist}


            </div>
            <!-- /.row -->
            <div class="page page_right">
                    <div>
                      {$list->render()}
                    </div>
            </div>

    </section>
    <!-- /.row -->
</section>
<!-- /.content -->


{/block} {block name='script'}
<script>
    //增加数据
    $(function () {
        //表格功能
        $('#example1').DataTable({
            'paging': true,
            'lengthChange': true,
            'searching': true,
            'ordering': false,
            'info': true,
            'autoWidth': true
        });


        //JQuery里面的方法,ajaxSubmit来提交表单
        var options = {
            type: 'post', //post提交
            //url:'http://ask.tongzhuo100.com/server/****.php?='+Math.random(),   //url
            dataType: "json", //json格式
            data: {}, //如果需要提交附加参数，视情况添加
            clearForm: false, //成功提交后，清除所有表单元素的值
            resetForm: false, //成功提交后，重置所有表单元素的值
            cache: false,
            async: false, //同步返回
            success: function (data) {
                if (data.code == 0) {
                    layer.msg(data.msg, {
                        icon: 2,
                        offset: 'm',
                        time: 1000
                    });
                } else {
                    layer.msg(data.msg, {
                        icon: 1,
                        offset: 'm',
                        time: 1500
                    }, function () {
                        location.reload();
                    });
                }
                //服务器端返回处理逻辑
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                layer.msg('操作失败:服务器处理失败');
            }
        };

        layui.use('form', function(){
            var form = layui.form;
            $('#mainForm').ajaxForm(options).submit(function(data){});
        });

    })
    //新增用户的模态框数据清除
    $("#addModal,#editModal").on('hide.bs.modal', function () {
        $('#addReset').click();
    });
    //加载缓冲动画
    $("#addModal,#editModal").on('show.bs.modal', function () {
        layer.closeAll();
    });


    //删除用户
    function delete_register(id) {
        layer.confirm('确定删除吗？', function (index) {
            $.ajax({
                    url: '{:url("merchant/Register/delete_register")}',
                    type: 'get',
                    dataType: 'json',
                    data: {
                        id: id
                    },
                })
                .done(function (data) {
                    //回调提示
                    if (data.code == 0) {
                        layer.msg(data.msg, {
                            icon: 2,
                            time: 1000
                        });
                    } else {
                        layer.msg(data.msg, {
                            icon: 1,
                            time: 1500
                        }, function () {
                            location.reload();
                        });
                    }
                })
        })
    }
</script>
{/block}